namespace SmartPeople.Framework.SecuritySpace
{
    public interface ISecuritySpace
    {
        Intializer Intializer { get; set; }

        /// <summary>
        /// Gets the users.
        /// </summary>
        /// <value>The users.</value>
        SecurityUsers Users { get; }

        /// <summary>
        /// Gets the roles.
        /// </summary>
        /// <value>The roles.</value>
        SecurityRoles Roles { get; }

        /// <summary>
        /// Gets or sets the current user.
        /// </summary>
        /// <value>The current user.</value>
        ISecurityUser CurrentUser { get; set; }

        /// <summary>
        /// Gets the secured types.
        /// </summary>
        /// <value>The secured types.</value>
        SecuritySecuredTypes SecuredTypes { get; }

        /// <summary>
        /// Gets the secured documents.
        /// </summary>
        /// <value>The secured documents.</value>
        SecuritySecuredDocuments SecuredDocuments { get; }

        /// <summary>
        /// Gets the security permissions.
        /// </summary>
        /// <value>The security permissions.</value>
        ISecurityPermissions SecurityPermissions { get; }


        bool IsUserGranted(string userName, string objectPath);
        bool IsUserGranted(IToken usertoken, string objectPath);

        bool IsUserGranted(string userName, string objectPath, string actionName);
        bool IsUserGranted(IToken usertoken, string objectPath, string actionName);

        bool IsUserGranted(string userName, string objectPath, string actionName, string stateName);
        bool IsUserGranted(IToken usertoken, string objectPath, string actionName, string stateName);


        /// <summary>
        /// Clears this instance.
        /// </summary>
        void Clear();

        #region Permission Methods.

        ISecurityPermission CreatePermission(string roleName, string documentFullName, AccessType accessType);

        ISecurityPermission CreatePermission(string roleName, string documentFullName, string actionName,
                                             AccessType accessType);

        ISecurityPermission CreatePermission(string roleName, string documentFullName, string actionName,
                                             string stateName,
                                             AccessType accessType);

        ISecurityPermission GrantPermission(string roleName, string documentFullName);
        ISecurityPermission GrantPermission(string roleName, string documentFullName, string actionName);

        ISecurityPermission GrantPermission(string roleName, string documentFullName, string actionName,
                                            string stateName);

        ISecurityPermission DenyPermission(string roleName, string documentFullName);
        ISecurityPermission DenyPermission(string roleName, string documentFullName, string actionName);
        ISecurityPermission DenyPermission(string roleName, string documentFullName, string actionName, string stateName);

        void RevokePermission(string roleName, string documentFullName);
        void RevokePermission(string roleName, string documentFullName, string actionName);
        void RevokePermission(string roleName, string documentFullName, string actionName, string stateName);

        #endregion
    }
}